home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_sharkdoors.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  224 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_sharkdoors.cog
  4. #
  5. # Open the doors in the shark area
  6. # [CMG]
  7. #
  8. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  9. # ========================================================================================
  10.  
  11. symbols
  12.     
  13.  
  14.     #.............MESSAGES.............
  15.     message    startup        
  16.     message    crossed    
  17.     message    blocked        
  18.     message    activated        
  19.  
  20.     
  21.     #.............ACTORS.............
  22.     thing        player                          local
  23.     thing        indy        
  24.     
  25.     
  26.     #.............COGS.............
  27.     cog            doortalkcog
  28.  
  29.     
  30.     #.............PROPS.............
  31.     thing        door0        
  32.     thing        door1        
  33.     thing        keybox                            linkid=3
  34.     thing        camtarget        
  35.     thing        tempCam                         local        
  36.     thing       camPos                          local        
  37.     thing       curCam                          local        
  38.     sector        doorSector                        local
  39.     
  40.     
  41.     #.............TRIGGERS.............
  42.     surface        adjoin0                              linkid=1        mask=0x405
  43.     surface        adjoin1                            linkid=2        mask=0x405
  44.     
  45.     
  46.     #.............VARIABLES.............
  47.     float        doorspeed=4.0
  48.     float        sleepTime=2.0
  49.     int            open=0                            local
  50.     int            keyed=0                            local
  51.     int            checked=0                        local
  52.     int            keyPlace                        local
  53.     
  54.     float        lightValueR=0.2
  55.     float        lightValueG=0.1
  56.     float        lightValueB=0.1
  57.         
  58.     #.............KEYFRAMES.............
  59.     keyframe    inReach=in_activate_medium.key  local
  60.         
  61.     #.............VECTORS.............
  62.     vector        vecLightValue                    local
  63.  
  64.     #.............SOUNDS.............
  65.     sound       placement=tem_tikikey_place_c.wav        local
  66.     sound       locked1=INXJ081.WAV                local
  67.     sound       locked2=INXJ076.WAV                local
  68.     sound       locked3=INXJ077.WAV                local
  69.     
  70. end
  71.  
  72. # ========================================================================================
  73.  
  74. code
  75.  
  76. startup:
  77.  
  78.     player = GetLocalPlayerThing();
  79.  
  80.     doorSector = GetThingSector(door0);
  81.     SetSectorAdjoins(doorSector, 0);
  82.  
  83.     vecLightValue = VectorSet(lightValueR, lightValueG, lightValueB);
  84.     SetSectorLight(doorSector, vecLightValue, 0.0);        // add some light to door sector
  85.     return;
  86.  
  87. # ........................................................................................
  88.  
  89. crossed:
  90.  
  91.         if (getSenderID() == 1)
  92.         {
  93.             if (keyed == 0) return;
  94.             if (open == 1) return;
  95.             if (IsThingMoving(door0)) return;
  96.             else
  97.         {
  98.                 open = 1;
  99.                 SetSectorAdjoins(doorSector, 1);
  100.                 Rotate(door0, -90, 1, doorspeed);
  101.                 Rotate(door1, 90, 1, doorspeed);
  102.                 waitforstop(door0);
  103.                 sleep(sleeptime);
  104.                 Rotate(door0, 90, 1, doorspeed);
  105.                 Rotate(door1, -90, 1, doorspeed);
  106.                 waitforstop(door0);
  107.                 SetSectorAdjoins(doorSector, 0);
  108.                 open = 0;
  109.                 
  110.             }
  111.         }
  112.     else if (GetSenderID() == 2)
  113.         {
  114.                 
  115.             print("opening check");
  116.             if (keyed == 0) return;
  117.             if (open == 1) return;
  118.             if (IsThingMoving(door0)) return;
  119.             else
  120.             {
  121.                 open = 1;
  122.                 SetSectorAdjoins(doorSector, 1);
  123.                 Rotate(door0, 90, 1, doorspeed);
  124.                 Rotate(door1, -90, 1, doorspeed);
  125.                 waitforstop(door0);
  126.                 sleep(sleeptime);
  127.                 Rotate(door0, -90, 1, doorspeed);
  128.                 Rotate(door1, 90, 1, doorspeed);
  129.                 waitforstop(door0);
  130.                 SetSectorAdjoins(doorSector, 0);
  131.                 open = 0;
  132.              }
  133.         }
  134. return;        
  135. #========================================================
  136. activated:
  137.  
  138.         If (keyed == 1) return;
  139.         if ((GetSenderRef() == keybox) && (keyed == 0) && (GetCurItem(player) == 59))
  140.                     {
  141.                           curCam = GetCurrentCamera();
  142.                           
  143.                           # Disable and hide player
  144.                           SetThingFlags(player, 0x80000);
  145.                                 
  146.                           # Cut to cutscene camera
  147.                           camPos = VectorSet(-0.1, 0.0, 0.2);
  148.                           SetExtCamOffset(camPos);
  149.                           ClearThingFlags(indy, 0x80000);
  150.                           keyed = 1;
  151.                           open = 1;
  152.                           
  153.                           # Play the animations - wait for Indy's
  154.                           PlayKey(indy, inReach, 4, 0x12, 1);
  155.                           keyPlace = PlaySoundLocal(placement, 1.0, 0.0, 0x0, 0);
  156.                           ChangeInv(player, 58, -1);
  157.                           #new trick?
  158.                           SetCameraLookInterp(curCam, 1);
  159.                           SetCameraSecondaryFocus(curCam, camtarget);
  160.                           
  161.                           SetSectorAdjoins(doorSector, 1);
  162.                           Rotate(door0, -90, 1, doorspeed);
  163.                           Rotate(door1, 90, 1, doorspeed);
  164.                           waitforstop(door0);
  165.                           Sleep(.25);
  166.                           # Return control and camera to player
  167.                           SetThingFlags(indy, 0x80000);
  168.                           CopyOrientAndPos(indy, player);
  169.                           ClearThingFlags(player, 0x80000);
  170.                           RestoreExtCam();
  171.                           sleep(sleeptime);
  172.                           Rotate(door0, 90, 1, doorspeed);
  173.                           Rotate(door1, -90, 1, doorspeed);
  174.                           waitforstop(door0);
  175.                           SetSectorAdjoins(doorSector, 0);
  176.                           open = 0;
  177.                     }
  178.                else
  179.                 {
  180.                     If ((GetSenderRef() == keybox) && (checked == 0))
  181.                         {
  182.                         curCam = GetCurrentCamera();
  183.                         # Disable and hide player
  184.                         SetThingFlags(player, 0x80000);
  185.                               
  186.                         # Cut to cutscene camera
  187.                         camPos = VectorSet(-0.1, 0.0, 0.2);
  188.                         SetExtCamOffset(camPos);
  189.                         ClearThingFlags(indy, 0x80000);
  190.                         PlayVoice(indy, locked1, 1.0, 1);
  191.                         SetThingFlags(indy, 0x80000);
  192.                         CopyOrientAndPos(indy, player);
  193.                         ClearThingFlags(player, 0x80000);
  194.                         RestoreExtCam();
  195.                         checked = 1;
  196.                         return;
  197.                         }
  198.                     If ((GetSenderRef() == keybox) && (checked == 1))
  199.                         {
  200.                         PlayVoice(player, locked2, 1.0, 1);
  201.                         checked = 2;
  202.                         return;
  203.                         }
  204.                     If ((GetSenderRef() == keybox) && (checked == 2))
  205.                         {
  206.                         PlayVoice(player, locked3, 1.0, 1);
  207.                         return;
  208.                         } 
  209.                 }
  210.        
  211.  
  212. return;
  213.  
  214. # ........................................................................................
  215.  
  216. blocked:
  217.     print("????");
  218.     return;
  219.  
  220. # ........................................................................................
  221.  
  222. end
  223.  
  224.